<?php
/**
 * Introduction: 商品收藏
 * @author: 杨陈鹏
 * @date: 2016/4/18 12:00
 * @email: yangchenpeng@cdlinglu.com
 */


namespace WeChat\Controller\Goods;


use Common\Controller\WeChat\SignController;

class CollectionController extends SignController
{

    public function lists()
    {

        $logic = D('Common/Goods','Logic');

        $page = I('post.page',1);
        $nums = I('post.nums',20);

        outPut($logic::getCollectionData(self::$uid,$page,$nums));

    }
    /**
     * @introduction: 收藏商品
     * @author: 杨陈鹏
     * @email: yangchenpeng@cdlinglu.com
     * @param array $data 商品数据
     * @param int $uid 用户ID
     */
    public function collection()
    {
        /*

        var data = {
            data:{goods_id:434}
        }
         */
        $data = I('post.data');


        $data['uid'] = self::$uid;


        $logic = D('Common/Goods', 'Logic');


        outPut($logic::collection($data));

    }

    /**
     * @introduction: 删除收藏
     * @author: 杨陈鹏
     * @email: yangchenpeng@cdlinglu.com
     * @param array $data 商品数据
     * @param int $uid 用户ID
     */
    public function delCollection()
    {
        $data = I('post.data');

        /*
            var data = {

                data:{ids:'343,2323,43'}
            }
         */

        $data['uid'] = self::$uid;


        $logic = D('Common/Goods', 'Logic');


        outPut($logic::delCollection($data));

    }

    /**
     * @introduction: 检测商品是否被收藏
     * @author: 杨陈鹏
     * @email: yangchenpeng@cdlinglu.com
     * @param array $data 商品数据
     * @param int $uid 用户ID
     */
    public function checkCollection()
    {

        $data = I('post.data');

        $data['uid'] = self::$uid;

        $logic = D('Common/Goods', 'Logic');

        outPut($logic::checkCollection($data));

    }

}